package com.xxja.order.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xxja.order.order.pojo.OrderDetail;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {

    @Insert("<script>insert into tb_order_detail " +
            "(id, order_id,good_id,num,title,price,own_spec,image) values" +
            "<foreach item = 'detail' collection = 'details' separator = ','>" +
            "(#{detail.id}, #{detail.orderId}, #{detail.goodId}, #{detail.num}," +
            " #{detail.title}, #{detail.price}, #{detail.ownSpec},#{detail.image}) </foreach></script>")
    void insertOrderDetail(List<OrderDetail> details);
}
